Smart card sample


Windows Runtime
Devices and sensors, Smart Card, virtual smart card
Windows RT
en-US
11/25/2013

This sample demonstrates how to use the Windows.Devices.SmartCards API to work with smart cards and smart card readers programmatically.

Specifically, this sample shows how to:

  • Create and set up a Trusted Platform Module (TPM) virtual smart card.
  • Change a user's personal identification number (PIN) for a physical smart card or TPM virtual smart card.
  • Reset a user's PIN for a physical smart card or TPM virtual smart card.
  • Change an admin key (also known as an administrator PIN or unblock PIN) for a physical smart card or TPM virtual smart card.
  • Create a challenge and verify the response for a physical smart card or TPM virtual smart card by using the admin key.
  • Delete a TPM virtual smart card.
  • List all smart cards on the device.

To obtain an evaluation copy of Windows 8.1, go to Windows 8.1.

To obtain an evaluation copy of Microsoft Visual Studio 2013, go to Visual Studio 2013.

Note  For Windows 8 app samples, download the Windows 8 app samples pack. The samples in the Windows 8 app samples pack will build and run only on Microsoft Visual Studio 2012.

Related topics

Windows.Devices.SmartCards
Windows app samples

Operating system requirements

Client
Windows 8.1
Server
Windows Server 2012 R2

Build the sample

  1. Start Visual Studio 2013 and select File > Open > Project/Solution.
  2. Go to the directory in which you unzipped the sample. Go to the directory named for the sample, and double-click the Visual Studio 2013 Solution (.sln) file.
  3. Press F7 or use Build > Build Solution to build the sample.

Run the sample

To debug the app and then run it, press F5 or use Debug > Start Debugging. To run the app without debugging, press Ctrl+F5 or use Debug > Start Without Debugging.

To test the sample's scenarios, run the app with the Local Machine setting in Microsoft Visual Studio (not Simulator or Remote Machine).

To create or delete a TPM virtual smart card, the machine must have a TPM chip installed. To verify this, open Device Manager and expand Security devices. If a TPM chip is available, a device entry containing the words Trusted Platform Module will appear.

After the app starts, select scenario 1 to create and provision a TPM virtual smart card. Modify the default values or leave them as-is, and select Create. Type and confirm a PIN, and select OK. After you successfully run scenario 1, you can test the other scenarios.